import numpy as np


def load_dataset(file_path):
    data_file = open(file_path, 'r')
    data_list = data_file.readlines()
    data_file.close()
    return data_list


def split_data(data_indices):
    all_values = data_indices.split(',')
    label = int(all_values[0])
    data = np.asfarray(all_values[1:])
    data = (data - 128 * np.ones(784,)) / 128.
    # data = data / 255.
    one_hot = np.zeros(10,)
    one_hot[label] = 1
    return data, one_hot
